<!DOCTYPE html>
<html>
<head>
<base href="${basePath}">
<meta charset="UTF-8">
<title>会员活动</title>
$!{include("import_js_css.html")}
$!{include("import_tab_switch.html")}
<!-- #set(Place place) -->
<!-- #set(GroupUserModel user,List<GroupUserModel> responsibles) -->
</head>
<body>
	${include("header.html")}
	<div class="menu_all">
		<div class="div_search_result clear">
			<div class="panel-heading panel-result-title">
				<h3 class="panel-title">活动详情</h3>
			</div>
			<div class="panel-form-add">
				<form class="form-horizontal" role="form"
					action="yueyogaAdmin/updateLiftClubs.jhtml" method="post">
					<div class="panel-form-layout">
						<label for="inputLiftClubName"
							class="col-sm-1 control-label">主题</label>
						<div class="col-sm-3">
							<input type="text" class="form-control" name="liftClubName" readonly style="background-color:#fff;" 
								id="inputLiftClubName" value="${name}" >
							<input type="hidden" name="liftClubId" value="${id}">
						</div>
						<label for="inputLiftClubStatus" class="col-sm-1 control-label" style="margin-left:100px;">状态</label>
						<div class="col-sm-3">
							<input type="text" class="form-control" readonly style="background-color:#fff;" name="inputLiftClubStatus" id="LiftClubStatus" value="${status}">
						</div>
						<br /> <br /> <label for="inputCoach0"
							class="col-sm-1 control-label">老师</label>
						<div class="col-sm-3">
							<input type="text" class="form-control" readonly style="background-color:#fff;" name="coachType0Id" id="inputCoach0" value="${coach0name}">
						</div>

						<label for="inputCoach1" class="col-sm-1 control-label" style="margin-left:100px;">助教</label>
						<div class="col-sm-3">
							<input type="text" class="form-control" readonly style="background-color:#fff;" name="coachType1Id" id="inputCoach1" value="${coach1name}">
						</div>
						<br /> <br /> <label for="inputResponsible"
							class="col-sm-1 control-label">负责人</label>
						<div class="col-sm-3">
							<input type="text" class="form-control" readonly style="background-color:#fff;" name="coachType1Id" id="inputCoach1" value="${usernames==null?username:usernames}">
						</div>
						<label for="inputPlacement" class="col-sm-1 control-label" style="margin-left:100px;">场地</label>
						<div class="col-sm-3">
							<input type="text" class="form-control" readonly style="background-color:#fff;" name="placement" id="inputPlacement" value="${placename}"/>
						</div>

						<br /> <br /> <label for="inputStartDate"
							class="col-sm-1 control-label">开始时间</label>
						<div class="col-sm-3">
							<input type="text" class="form-control" readonly style="background-color:#fff;" name="startdate" id="inputStartDate" value="${startdate}">
						</div>
						<label for="inputendDate" class="col-sm-1 control-label" style="margin-left:100px;">结束时间</label>
						<div class="col-sm-3">
							<input type="text" readonly class="form-control" style="background-color:#fff;" name="enddate" id="inputendDate" value="${enddate}">
						</div>
						<br /> <br /> <label for="inputCreditlimits"
							class="col-sm-1 control-label">积分下限</label>
						<div class="col-sm-3">
							<input type="text" class="form-control" readonly style="background-color:#fff;" name="creditlimits"
								id="inputCreditlimits" value="${creditlimits}"
								>
						</div>
						<br /> <br /> <label for="txtRemarks" class="col-sm-1 control-label">备注</label>
						<div class="col-sm-3">
							<textarea class="form-control panel-form-addreed panel-text-bg" readonly name="remarks" id="txtRemarks">${remarks}</textarea>
						</div>
						<br /> <br /><br /> <br />
					</div>
				</form>
			</div>
		</div>
		<div class="div_search_result clear">
		<!--#var(PaginatedList<Member> members)-->
		<!--
		#set(
		pager = members.pager,
		totalResults = pager.getCountOfTotalResults(),
		totalPages = pager.getCountOfTotalPages() * 1,
		pageSize = pager.pageSize,
		pageNo = pager.pageNo,
		prePageNo = pager.getPrevPageNo(),
		nextPageNo = pager.getNextPageNo()
		)
		-->
		<div class="panel-heading panel-result-title">
			<h3 class="panel-title" style="width:200px;">参加活动的会员列表</h3>
			<div class="btn-group btn-gp-default" style="width: 300px; margin-top: 2px">
				<!--#if(status=='活动结束')  -->
				<!--#else  -->
				<div class="input-group" id="div_add_club_member" style="width:160px; float:left;">
					<select id="memberSelect" name="memberSelect" class="selectpicker show-tick" data-width="200px" style="border-top-right-radius: 0px !important; float: left;">

						<option value=""> </option>
						<!-- #for(ClassMemberModel mm : allMembers) -->
						<option value="${mm.id}">
							<!-- #if(mm.memberCode != null && mm.memberCode != "") -->
								${mm.memberCode}-
							<!-- #end --> ${mm.name}
						</option>
						<!-- #end -->
					</select>
				</div>
				<!--#end  -->
				<div style="float:left;">
					<button id="quickMemberAdd"
						class="btn btn-default panel-radius-none" type="button">快速添加</button><button id="memberDelete"
						class="btn btn-default panel-radius-right" type="button"
						style="margin-left: -6px !important;">删除</button>
				</div>
			</div>
		</div>
		<!--#if(members)-->
			<table class="table table-bordered table-hover table-condensed tb"
				style="text-align: center">
				<tr>
					<td>编号</td>
					<td>姓名</td>
					<td>英文名</td>
					<td>手机号</td>
					<td>电话</td>
					<td>性别</td>
				</tr>
				<!-- #for(Member member:members) -->
				<tr>
					<td><a href="yueyogaAdmin/toMemberDetail.jhtml?id=${member.memberid}">${member.cardnumber}</a></td>
					<td><a href="yueyogaAdmin/toMemberDetail.jhtml?id=${member.memberid}">${member.name}</a></td>
					<td><a href="yueyogaAdmin/toMemberDetail.jhtml?id=${member.memberid}">${member.nameEn}</a></td>
					<td><a href="yueyogaAdmin/toMemberDetail.jhtml?id=${member.memberid}">${member.phone}</a></td>
					<td>${member.tel}</td>
					<td>${member.sex}</td>
				</tr>
			<!--#end-->
			</table>
			<div class="paging-page">
				<ul class="pagination">
					<li><a href="yueyogaAdmin/toLiftClubDetail.jhtml?id=${id}&pageNo=1">首页</a></li>
					<!-- #if(pageNo==1) -->
					<li class="disabled"><a href="javascript:void(0)">上一页</a></li>
					<!-- #else -->
					<li><a href="yueyogaAdmin/toLiftClubDetail.jhtml?id=${id}&pageNo=${prePageNo}">上一页</a></li>
					<!-- #end -->
					<!-- #if(pageNo==totalPages) -->
					<li class="disabled"><a href="javascript:void(0)">下一页</a></li>
					<!-- #else -->
					<li><a href="yueyogaAdmin/toLiftClubDetail.jhtml?id=${id}&pageNo=${nextPageNo}">下一页</a></li>
					<!-- #end -->
					<li><a href="yueyogaAdmin/toLiftClubDetail.jhtml?id=${id}&pageNo=${totalPages}">尾页</a></li>
					<li><a>第<input id="txtPageNumber" value="${pageNo}"
							onkeydown="this.value=this.value.replace(/\D/g,'')"
							onblur="changePage(this.value)"
							onafterpaste="this.value=this.value.replace(/\D/g,'')" type="text" />-${totalPages}页/${totalResults}条
					</a></li>
				</ul>
			</div>
		<!-- #else -->
			<div class="panel-body">还没有会员参加该活动</div>
		<!-- #end -->
		</div>
	</div>
</body>

<script type="text/javascript">
	function documentReady() {
		var msg = "${msg}";
		if(msg =="lcs"){
			Console.log("创建成功后，进入详情页面!");
		}else if (msg == "success") {
			Console.log("修改成功后，进入详情页面!");
		} else if (msg == "failure") {
			error("活动修改失败");
		}
	}
	function changePage(value) {
		value = value * 1;
		var totalPages = '${totalPages}';
		if (value > totalPages) {
			value = totalPages;
		} else if (value < 1) {
			value = 1;
		}
		$("#txtPageNumber").val(value);
		window.location.href = "yueyogaAdmin/toLiftClubDetail.jhtml?id=${id}&pageNo=" + value;
	}
	
	
	$(document).ready(function() {
		$("#memberSelect").select2({
			width: "160px"
		});
		
		//向活动中添加会员
		$("#quickMemberAdd").click(function() {
			var liftclubId = "${id}";
			var memberId = $("#memberSelect").select2("val");
			$.post(
				"yueyogaAdmin/addMemberToLiftClub.jhtml",
				{"liftclubId" : liftclubId, "memberId" : memberId},
				function(res) {
					var json = eval("(" + res + ")");
					if(json.success) {
						window.location.href = "yueyogaAdmin/toLiftClubDetail.jhtml?id=${id}&pageNo=${pageNo}";
					} else {
						error(json.msg);
					}
				}
			);
		});
		
		//从活动中删除会员
		$("#memberDelete").click(function() {
			var liftclubId = "${id}";
			var memberId = $("#memberSelect").select2("val");
			
			$.post(
				"yueyogaAdmin/deleteMemberFromLiftClub.jhtml",
				{"liftclubId" : liftclubId, "memberId" : memberId},
				function(res) {
					var json = eval("(" + res + ")");
					if(json.success) {
						window.location.href = "yueyogaAdmin/toLiftClubDetail.jhtml?id=${id}&pageNo=${pageNo}";
					} else {
						error(json.msg);
					}
				}
			);
		});
	});
	
	
</script>
</html>
